# 压缩目录
def zip_dir(dir_path,output_path):
    with zipfile.ZipFile(output_path,'w',zipfile.ZIP_DEFLATED) as zipf:
        for root ,dirs,files in os.walk(dir_path):
            for file in files:
                file_path = os.path.join(root,file)
                zipf.write(file_path,os.path.relpath(file_path,dir_path))